home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / lists / mint / l_1199 / 1688 < prev    next >
Encoding:
Internet Message Format  |  1994-08-27  |  2.1 KB

  1. From: Stephen Usher <Stephen.Usher@earth.ox.ac.uk>
  2. Subject: MiNTlib (I think I'm on pl43): Bug in sprintf().
  3. Date: Mon, 11 Jul 1994 08:10:13 +0100 (BST)
  4. Mime-Version: 1.0
  5.  
  6. Well I've had a fun weekend trying to get the NET/2 BSD version of
  7. telnet/in.telnetd running and... I've got telnet working.
  8.  
  9. During this hacking I found a rather nasty feature of sprintf(), though not
  10. printf(). I've not had a chance to look at the sprintf code at all so I'll
  11. just describe the "feature."
  12.  
  13. MiNTlib pl 43 (or is it 44.. I'm losing track of patchlevels these days) and
  14. GCC 2.3.3, no optimisation.
  15.  
  16. When a statement such as the following is run sprintf terminates after the
  17. first argument:-
  18.  
  19.     sprintf((char *)temp, "%c%c%c%c%s%c%c", IAC, SB, TELOPT_TERMTYPE,
  20.         TELOPT_QUAL, term, IAC, SB);
  21.  
  22.     where IAC, SB, TELOPT* are all non-ACSII characters with the top bit
  23.     set, ie. 127 < x < 256. The first two are actually (from memory)
  24.     0xff and 0xfa.
  25.  
  26. All you get in temp is the first byte, ie. 0xff. printf() works correctly.
  27.  
  28. Steve
  29.  
  30. PS. This is all from memory, so the first SB may not be correct, but the
  31. value 0xfa is. This, of course, doesn't matter for the bug report as it's to
  32. do with the telnet protocol.
  33.  
  34. PPS. in.telnetd isn't working.. well it is, partially, it doesn't echo
  35. characters and it loses the first character of every packet it sends! I've
  36. tested telnet by calling my Sun 3/80 and in.telnetd by calling it from the
  37. Sun.
  38.  
  39. PPPS. MiNTnet's PPP device works well, except for when there's a data
  40. overrun when it gets hopelessly confused and has to be restarted (after
  41. clearing the serial port input buffer using kermit). Kay, could you get your
  42. slattach to set the baud rate of the serial port using a command line option
  43. please so I can place the PPP startup in an rc file and not use kermit to
  44. set the port speed.
  45.  
  46. -- 
  47. ---------------------------------------------------------------------------
  48. Computer Systems Administrator, Dept. of Earth Sciences, Oxford University.
  49. E-Mail: steve@uk.ac.ox.earth (JANET) steve@earth.ox.ac.uk (Internet).
  50. Tel:- Oxford (0865) 282110 (UK) or +44 865 282110 (International).
  51.